<%--
  Created by IntelliJ IDEA.
  User: 23649
  Date: 2021/5/13
  Time: 8:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%
        String paths = request.getContextPath();
        String basePath= request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+paths+"/";
    %>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>sweetalert.css">
    <script type="text/javascript" src="<%=basePath%>sweetalert-dev.js"></script>
    <link rel="stylesheet" href="<%=basePath%>layui-v2.6.5/layui/css/layui.css"  media="all">
    <style type="text/css" >
        h3{
            margin-left: 600px;
        }
        #chongzhi{
            margin-left: 240px;
            position: absolute;
            top:265px;
        }
    </style>
</head>
<body>

    <h3 style="font-family: '华文新魏';font-size: 45px">个人信息</h3>

<div class="layui-form-item">
    <label class="layui-form-label">姓名</label>
    <div class="layui-input-block">
    <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input" readonly="readonly" value="${user.name}">
    </div>
</div>
    <div class="layui-form-item">
        <label class="layui-form-label">卡号</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input" readonly="readonly" value="${user.id}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号码</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input" readonly="readonly" value="${user.phone   }">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">余额</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input" readonly="readonly" value="${user.money}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">充值</label>
        <div class="layui-input-block">
            <input type="text" id="money" name="title" lay-verify="title" autocomplete="off" placeholder="请输入充值金额" class="layui-input" >
        </div>
    </div>
    <div id="chongzhi"><button type="button" class="layui-btn layui-btn-sm">充值</button></div>
<img src="<%=basePath%>img/dibu.jpg"  style="width: 1425px;">
    <script type="text/javascript" src="<%=basePath%>jquery-1.12.4.js"></script>
    <script type="text/javascript">
        $(function(){
            $("#chongzhi").click(function (){
                var amount=$("#money").val();
                var id=${user.id};
                if(money==null||money==""){
                    swal("错误", "未输入金额", "error");
                }else{
                    $.ajax({
                        url:"<%=basePath%>PageFrontdeskCardServlet",
                        type:"post",
                        data:{
                            operation:"rechargeable",
                            amount:amount,
                            id:id
                        },
                        dataType:"json",
                        success:function (data){
                            if(data){

                                swal({
                                   title:"成功",
                                   text:"充值成功"
                                },function () {
                                    window.location.reload();
                                })

                            }else{
                                swal("错误", "充值失败", "error");
                            }
                        }
                    })
                }
            })
        })
    </script>
</body>
</html>
